﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType;


namespace ERPEF.Model
{
    public class pur_Purchase_Order
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int ord_id { get; set; }//序号
        public string ord_number { get; set; }//采购订单编号
        public string ord_supplier { get; set; }//供应商
        public string ord_attribute { get; set; }//采购商品属性
        public string ord_types { get; set; }//商品种类
        public decimal ord_amount_due { get; set; }//应付金额
        public decimal ord_to_pay { get; set; }//订单已付款
        public char ord_state { get; set; }//订单状态
        public char ord_warehouse { get; set; }//入库状态
        public bool AuditStatus { get; set; }//审核状态
        public DateTime ord_purchase_date { get; set; }//采购日期
        public string ord_supplier_company { get; set; }//供应商公司名称
        public string ord_phone { get; set; }//联系人手机
        public string ord_supplier_address { get; set; }//供应商地址
        public decimal ord_purchase_amount { get; set; }//购货金额
        public decimal ord_discount_amount { get; set; }//优惠金额
        public decimal ord_freight { get; set; }//订单运费
        public bool IsDeleted { get; set; } = false;//逻辑删除

        public string? auditor { get; set; } //审核人   新增字段
        public DateTime? auditTime { get; set; } //审核时间 新增字段
        public string so_Return_status { get; set; }//退货状态
        
        public List<pur_Purchase_From> pur_Purchase_From { get; set; } // 从表数据
        public virtual string ToString()
        {
            if (pur_Purchase_From != null && pur_Purchase_From.Count > 0)
            {
                return pur_Purchase_From.Count + " - " + pur_Purchase_From[0].fro_purname;
            }
            else
            {
                return base.ToString(); // 或返回其他默认值  
            }
        }
    }
}
